package com.ruoyi.web.controller.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

@SpringBootConfiguration
public class SpringMvcConfigurationInitializer implements WebMvcConfigurer {

    @Value("${ffmpeg.savePath}")
    private String localVideoDir;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**")
                .addResourceLocations(new String[]{"file:" + localVideoDir});
    }
}

